VtCheckBox
Create a CheckBox widget
Syntax
VtCheckBox object_name [options]
Description
Creates a CheckBox widget. Returns the widget name.
Options
- -callback cmd (C)
- Specifies that cmd is called when a ToggleButton in
the CheckBox is selected (using <Space>, <Enter> or a
mouse button). This overrides any individual callback set for the
ToggleButtons contained within the CheckBox. For more information
about ToggleButtons, refer to the VtToggleButton
manual page.
Additional callback keys:
- (selectedWidgetList
- a list of selected ToggleButtons)
- value
- a list of selected ToggleButtons
- -horizontal (CS)
- Specifies that the contents of the CheckBox are to be arranged
horizontally.
- -numColumns integer (CS)
- Specifies the number of columns of objects in the CheckBox.
- -spacing integer (CS)
- Specifies the spacing between objects in the CheckBox.
- -value widgetName (CS)
- The specified ToggleButton is set (turned on) when the CheckBox
is created. All other ToggleButtons within the CheckBox are unset
(turned off). To set more than one button, use the
-valueList option.
- -valueList list (CSG)
- list is a list of ToggleButton widget names. All
ToggleButtons specified in this list are set (turned on) when the
CheckBox is created. All other ToggleButtons within the CheckBox are
unset (turned off).
- -vertical (CS)
- Specifies that the contents of the CheckBox are to be arranged
vertically.
Example
The following example creates a CheckBox which arranges its contents
horizontally in two columns. Four ToggleButtons are created
to illustrate the CheckBox's behaviour.
set app [VtOpen "Fruits"]
set checkbox [VtCheckBox $app.checkbox \
-horizontal \
-numColumns 2]
set toggle1 [VtToggleButton $checkbox.toggle1 \
-label Oranges]
set toggle2 [VtToggleButton $checkbox.toggle2 \
-label Apples]
set toggle3 [VtToggleButton $checkbox.toggle3 \
-label Bananas]
set toggle4 [VtToggleButton $checkbox.toggle4 \
-label Kumquats]
VtShow $checkbox
VtMainLoop
This code produces the following:
See also: